<template>
  <div>
    <el-button type="primary" @click="search()">查询</el-button>
  </div>
</template>

<script setup lang="ts">
import { PendingContractTableData } from "../../utils/PendingContract/Table";
import { useCounterStore } from "../../pinia/index";
import { getPendingContractTable } from "../../http/api/PendingContract/index";
let props = defineProps({
  options: {
    type: Array,
  },
});
let Store = useCounterStore();
let search = () => {
  
  if(Store.PendingContractTable.length<10){
    getPendingContractTable().then((res)=>{
      Store.PendingContractTable=res.data
    })
   }
  if (props.options?.length == 4) {
    Store.PendingContractTable=PendingContractTableData(props.options)
  } else {
    if (props.options[0] == undefined) {
      ElMessage.error("请正确选择签约状态，重新查询");
    } else if (props.options[1] == undefined) {
      ElMessage.error("请正确选择签约机构，重新查询");
    } else if (props.options[2] == undefined) {
      ElMessage.error("请正确选择医生团队，重新查询");
    } else if (props.options[3] == undefined) {
      ElMessage.error("请正确选择服务包，重新查询");
    }
  }
};
</script>

<style scoped></style>
